<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入vue文件-->
    <script src = "js/vue.js"></script>
    <style>
        #d1{
            position: absolute;
            top: 30px ;
            width: 200px;
            height: 200px ;
            background-color:red ;
        }
        #d2{
            position: absolute;
            top: 30px ;
            width: 100px;
            height: 100px ;
            background-color: green  ;
        }
        #d3{
            position: absolute;
            top: 30px ;
            width: 50px;
            height: 50px ;
            background-color:blue ;
        }
    </style>

</head>
<body>
    <!--创建一个容器-->
    <div id="app">
         <a href = "http://www.sohu.com" @click.prevent = "fun">搜狐</a><br />
         
         <!-- <div id = "d1" @click = "fun1">
            <div id = "d2" @click = "fun2">
                <div id = "d3" @click.stop = "fun3"></div>
            </div>
         </div> -->
         <button @click = "fun4">点我，我会弹出框</button>
         <button @click.once = "fun4">点我，我只会弹1次哦</button>
         
    </div>
   
    <script>
        //创建一个控制器，控制容器显示的数据
        let vm = new Vue({
            el: '#app' ,  //控制那个容器
            methods: {
                fun() {
                   alert("我要去搜狐页面了")
                } ,
                fun1(){
                    console.log("red")
                } ,
                fun2(){
                    console.log("green")
                } ,
                fun3(){
                    console.log("blue")
                } ,
                fun4(){
                    alert("我出来了") ;
                }
            },
        })
    </script>
</body>
</html>